#include "KdTreeMemoryManager.h"

KdTreeMemoryManager::KdTreeMemoryManager() :
	MemoryManager(KDTREEMEMORYMANAGER_INITIAL_SIZE, KDTREEMEMORYMANAGER_RESIZE)
{
	while((unsigned long)(data + cur) & 7)
		cur++;
}

KdTreeMemoryManager::~KdTreeMemoryManager()
{

}

char* KdTreeMemoryManager::request(const int amount)
{
//	while((unsigned long)(data + cur) & 7)
//		MemoryManager::request<char>(1);
	char* tmp = MemoryManager::request<KdNode>(amount);
	return tmp;
}

//char* KdTreeMemoryManager::request(const int amount)
//{
//	//		std::cout << cur + amount + 1 << std::endl;
//	//		std::cout << size << std::endl;
//	if (cur + amount + 1 >= size)
//	{ // we need to reallocate
//		//			size += RESIZE;
//		//			data = (M*)realloc(data, sizeof(M) * size);
//		/**
//		 * HACK
//		 */
//		std::cout << "Memory-request failed!" << std::endl;
//		exit(-1);
//	}
//
//	cur += amount;
//	return &(data[cur - amount]);
//}
